/**
 * Created by xx on 2019/4/29.
 */
const is__d_call = require('./is__d_call');

// 统计__d(...)的个数
function count__d_call_percentage(ast){
	var __d_call_count = 0;
	var other_call_count = 0;
	var body = ast.body;
	var len = body.length;
	for(var i=0; i<len; i++){
		var itm_ast = body[i];
		if(is__d_call(itm_ast)){
			__d_call_count++;
		} else {
			other_call_count++;
		}
	}
	console.log('__d_call_count = ' + __d_call_count);
	var percentage = __d_call_count / len;
	return percentage;
}

module.exports = count__d_call_percentage;